<div>
	<?php 
	echo $this->Html->scriptBlock('
		$(document).ready(function() {
			$("#OrdemservicosStatusOrdemservicoId").setMask({mask: "9", type: "repeat"}).css("text-align", "right");
	  	});
	', array('inline' => true));
	if( $msg ) 
			echo '<script type="text/javascript">alert("'.$msg.'");</script>'; 
	?>
	<div class="titulo_pagina">
		<p> RELATÓRIO DE ENTREGAS </p>
	</div>
	<?php 
		echo $this->Form->create('OrdemservicosStatus');
		echo $this->Form->input('ordemservico_id', array('label' => 'OS', 'type' => 'text'));
		echo 'TIPO';
		echo $this->Form->input('garantia', array('label' => 'Garantia', 'type' => 'checkbox'));
		echo $this->Form->input('orcamento', array('label' => 'Orçamento', 'type' => 'checkbox'));
		
		echo 'PERÍODO DE';
		echo $this->Form->input('datainicial', array('label' =>false));
		echo 'A';
		echo $this->Form->input('datafinal', array('label' =>false));
		
		echo $ajax->datepicker('OrdemservicosStatusDatainicial');
		echo $ajax->datepicker('OrdemservicosStatusDatafinal');
		
		echo $ajax->submit('Imprimir Relatório', array('url'=> array('controller'=>'ordemservicos', 'action'=>'imprimirRelatorio'), 'update' => 'inicial'));
		echo $this->Js->submit('Ok', array('div' => false, 'update' => '#inicial'));
		echo $this->Form->end();
		echo $this->Js->writeBuffer();
	?>
</div>
<table>
  <tr>
    <th align="center" width="10%">OS</th>
    <th align="center" width="10%">TIPO</th>
    <th align="center" width="25%">CLIENTE</th>
    <th align="center" width="10%">DATA ENTREGA</th>
    <th align="center" width="10%">TEMPO ENTREGA</th>
    <th align="center" width="10%">VALOR</th>
    <th align="center" width="25%">ENTREGADOR</th>
  </tr>
  <?php
	$i = 0;
	foreach ($entregas as $entrega):
		$class = null;
		if ($i++ % 2 == 0) {
			$class = ' class="altrow"';
		} 
	?>
	<tr<?php echo $class;?>>
		<td align="center" width="10%"><?php echo $entrega['OrdemservicosStatus']['ordemservico_id']; ?></td>
		<td align="center" width="10%"><?php echo $entrega['Ordemservico']['tipo']; ?></td>
		<td align="center" width="25%"><?php echo $entrega['Ordemservico']['cliente']; ?></td>
		<td align="center" width="10%"><?php echo $entrega['Ordemservico']['entregadata']; ?></td>
		<td align="center" width="10%"><?php echo $entrega['Ordemservico']['tempoentrega']; ?></td>
		<td align="center" width="10%"><?php echo 'R$ ' . number_format($entrega['Ordemservico']['Pagamento'][0]['taxaentrega'], 2, ',','.'); ?></td>
		<td align="center" width="25%"><?php echo $entrega['OrdemservicosStatus']['funcionario']; ?></td>
	</tr>
<?php endforeach; ?>
</table>